/*
 * Copyright Radosław Smogura, 2012. All rights reserved.
 *
 * The content of this file is confidential and it is intelectual property
 * of copyright owners.
 * 
 *
 * $URL: http://reprap-ide.googlecode.com/svn/trunk/RepRapIDE/RepRapProject/src/main/java/eu/softper/reprap/project/nodes/RepRapProjectRootNode.java $
 * $Id: RepRapProjectRootNode.java 3 2012-11-19 10:58:30Z mail@smogura.eu $
 * $Revision: 3 $
 */
package eu.softper.reprap.project.nodes;

import eu.softper.reprap.project.RepRapProject;
import eu.softper.reprap.project.nodes.actions.AddStlFileAction;
import java.awt.Image;
import java.lang.invoke.MethodHandles;
import javax.swing.Action;
import org.netbeans.spi.project.ui.support.CommonProjectActions;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.lookup.Lookups;

/**
 *
 * @author Radosław Smogura
 */
public class RepRapProjectRootNode extends AbstractNode {
    private Image icon;
    
    public RepRapProjectRootNode(RepRapProject project, Children children) {
        super(children, Lookups.fixed(project, project.getProjectDirectory()));
    }

    @Override
    public Image getIcon(int type) {
        if (icon == null) {
            icon = ImageUtilities.loadImage("eu/softper/reprap/project/images/reprap_logo.png").getScaledInstance(16, 16, Image.SCALE_SMOOTH);
        }
        
        return icon;
    }

    @Override
    public Image getOpenedIcon(int type) {
        return getIcon(type);
    }

    
    @Override
    public String getDisplayName() {
        return getLookup().lookup(RepRapProject.class).getConfig().getName();
    }

    @Override
    public Action[] getActions(boolean context) {
        return new Action[] {
            CommonProjectActions.closeProjectAction(),
            CommonProjectActions.customizeProjectAction()
        };
    }
    
    
}
